package com.parking.status.sync.netty.client;

import com.parking.status.sync.netty.entity.ContentBase;
import com.parking.status.sync.netty.entity.ContentParkingLot;
import com.parking.status.sync.netty.entity.MessageBody;
import com.parking.status.sync.netty.util.LocalInfo;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToMessageEncoder;

import java.util.List;

/**
 * Created by Administrator on 2015/9/16.
 */
public class ContentEncoder extends MessageToMessageEncoder<ContentBase> {

    @Override
    protected void encode(ChannelHandlerContext channelHandlerContext, ContentBase content, List<Object> out) throws Exception {
        MessageBody frame = new MessageBody(LocalInfo.getCompanyCode(), LocalInfo.getAddressCode(), LocalInfo.getRevAddressCode(), content);
        out.add(frame);
    }
}